<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
 CalenderUI();
 link_js(array('jquery.fixedheader','bootstrap-typeahead'),'asset/js/');
 ?>
<!--<div class='container'>-->
     <div class="tabbable"> <!-- Only required for left/right tabs -->
	<?=$tab_header;?>
       <div class="tab-content" style=''>
	   <br>
            <div class="tab-pane" id="table1"></div>
            <div class="tab-pane active" id="table2"><?=$this->zetro_auth->allAuth($list,'limit_pinjaman');?></div></div>
       </div>
		<input type='hidden' id='row_aktif' value='<?=empty($_GET['ot'])?'n':$_GET['ot'];?>'/>
		<input type='hidden' id='rows' value='<?=base64_decode($this->session->userdata('menus'));?>'/>
    </div>
<!--</div>-->
<?=$modal;?>
<script language='javascript'>
$(document).ready(function(e) {
	$('div.tab-content').css('height',(screen.availHeight-275));
	_show_data('');
	$('#simpan').click(function(){ _simpan_data();});
	$('#batal').click(function(){ document.frm4.reset();$('#myModal').modal('hide');});

})
function _simpan_data()
{
	$.post('setlimitpinjaman',$('#frm4').serialize(),function(result)
	{
		_show_data('1');
		$('#batal').click();
	})
}
function _show_data(tp)
{
	show_indicator('NewList',9);
	$.post('getlimitpinjaman',$('#frm1').serialize()+'&ot='+$('#row_aktif').val(),function(result)
	{
		$('#NewList tbody').html(result);
		(tp=='')?
		$('#NewList').fixedHeader({'width':(screen.availWidth-50),'height':(screen.availHeight-370)}):'';
	})
}
function btn_click(id,aksi)
{
	switch(aksi)
	{
		case 'edit':
		_show_popup(id);
		break;
		case 'delete':
		jAlert('Gunakan proses edit dengan nilai 0 untuk mengosongkan max limit','ziebar alert');
		break;
	}
}

function _show_popup(id)
{
	$.post('getdetaillimit',{'id':id},function(result)
	{
		var r=$.parseJSON(result)
		$('#id_simpanan').val(r.id_simpanan);
		$('#nm_simpanan').val(r.nm_simpanan).attr('readonly','readonly');
		$('#max_limit').val(r.max_limit).priceFormat();
	 	$('.modal-body').css('overflow','hidden');
	 	$('#myModal').modal('show');	
	})
	
}

</script>